#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
int a[3];

void solve() {
	for (int i = 0; i < 3; i++) cin >> a[i];
	sort(a, a + 3);
	cout << a[1] << endl;
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t; cin >> t;
	while (t--) {
		solve();
	}
}